#include <stdio.h>

int is_little_endian ()
{
    union {
        int a;
        char c[4];
    } var;
    
    var.a = 0xabcd1234;
  
    return (var.c[0] == 0x34);
}

int main(int argc, char *argv[])
{
    int a=0xaabb1122;
    char *p = (char*)&a;

    if (*p == 0x22) {
        printf("little endian\n");
    } else {
        printf("big endian\n");
    }

    if (is_little_endian) {
        printf ("little endian\n");
    } else {
        printf("big endian\n");
    }
    
    return 0;
}
